<?php

!defined('BASE_PATH')&&die('forbidden');

if (!class_exists('core_route_routerbase',false)) {
	include(core::parse_class_path('core_route_routerbase'));
}

class core_route_router extends core_route_routerbase {
	
	public static function route($request_uri = ''){
		
		if(!$request_uri){
			$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
		}

		parent::route($request_uri);
		
	}
	
	public static function get_action(){
		
		$action = parent::get_action();
		
		if (!preg_match('/^[a-zA-Z_]\w*$/',$action)) {
			
			core::exit_404('action involved.');
			
		}
		
		return $action;
		
	}
	
	public static function get_method(){
		
		$method = parent::get_method();
		
		if (!preg_match('/^[a-zA-Z_]\w*$/',$method) || '__' == substr($method,0,2)) {
			
			core::exit_404('method involved.');
			
		}
		
		return $method;
		
	}
	
	public static function build_uri($action='welcome',$method='index',$args=array(),$query_string=''){
		
		return parent::build_uri($action,$method,$args,$query_string);
		
	}
	
}

?>